#include<iostream>

const int size=10;

class ArrayStack
{
public:
    ArrayStack():top(0){}
    //入栈操作
    void push(int data)
    {
        if(top== size)
        {
            std::cout<<"栈满了\n";
            return;
        }
        Stack[top++]=data;
    }

    //出栈
    void Pop()
    {
        if(top==0)
        {
            std::cout<<"栈空\n";
            return;
        }
        top--;
    }

    int* GetTop()
    {
        if(top==0)
            return nullptr;
        return Stack+ top-1;
    }

    bool IsEmpty()
    {
        return top== 0;
    }

private:
    int Stack[size];
    int top;
};



int main()
{
    ArrayStack s;
    for(int i=0; i<13; i++)
    {
        s.push(i+1);
    }

    while(!s.IsEmpty())
    {
        std::cout<<*s.GetTop()<<" "; //显示栈顶元素
        s.Pop();
    }
    std::cout<< std::endl;

    return 0;
}